const express = require('express');
const router = express.Router()
const pool = require('../utils/pool')

//新增业务类型
router.post('/addyw',(req,res,next)=>{
    pool.query('insert into classify set ?',[req.body],(err,r)=>{
        if(err) {
            return next(err)
        }
		// 插入数据不需要判断
		res.send({code: 200, msg: '添加成功'})
    })
})

router.post('/addfw',(req,res,next)=>{
    pool.query('insert into sclassification set ?',[req.body],(err,r)=>{
        if(err) {
            return next(err)
        }
		// 插入数据不需要判断
		res.send({code: 200, msg: '添加成功'})
    })
})

router.get('/query-fw',(req,res,next)=>{
    pool.query('select vwork,scid from classify,sclassification where cid=clid and busclass=?',[req.query.busclass],(err,r)=>{
        if(err){
            return next()
        }
        res.send({code: 200, msg: 'ok',data:r})
    })
})
module.exports = router;
